home *** CD-ROM | disk | FTP | other *** search
- Path: gabi-soft.fr!usenet
- From: kanze@gabi-soft.fr (J. Kanze)
- Newsgroups: comp.std.c
- Subject: Re: Q: char **foo, char *foo[], and char foo[][] ?
- Date: 18 Apr 1996 08:59:49 GMT
- Organization: GABI Software, Sarl.
- Distribution: world
- Message-ID: <KANZE.96Apr18105949@gabi.gabi-soft.fr>
- References: <4l33ok$oo2@Sherlock.lectra.fr>
- NNTP-Posting-Host: gabi.gabi-soft.fr
- In-reply-to: phil@rd.lectra.fr's message of 17 Apr 1996 15:46:28 GMT
-
- In article <4l33ok$oo2@Sherlock.lectra.fr> phil@rd.lectra.fr (Philippe
- Maurisset) writes:
-
- |> Considering the 3 following declarations:
-
- |> 1 - char **foo;
- |> 2 - char *foo[];
- |> 3 - char foo[][];
-
- |> I know that there is a (big !) difference in memory reservation, but I do not know
- |> if foo IS or IS NOT of the same type in these three cases.
-
- They are definitly not the same type, however...
-
- |> To summarize my question :
- |> Is the first one securely usable for casting a variable of the third kind, when
- |> calling a function where it is defined as the second kind ?
-
- |> Follwing is a description (the 2 functions are in differents sources files) :
-
- |> myexample()
- |> {
- |> char foo[MAX_X][MAX_Y];
- |> ...
- |> myfunc( (char **)foo );
- |> }
-
- |> void myfunc( char *foo[MAX_X] )
- ^^^^^^^^^^^^^^^^
-
- Because it appears as a function parameter, this is actually a
- declaration of a char**, and not a char*[].
-
- So in fact, you have no type incompatibility to deal with.
- --
- James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
- Conseils en informatique industrielle --
- -- Beratung in industrieller Datenverarbeitung
-